.class public abstract Les/wu;
.super Ljava/lang/Object;
.source "Pipeline.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Les/wu$b;
    }
.end annotation


# static fields
.field private static final k:Ljava/lang/String; = "wu"


# instance fields
.field private volatile a:Z

.field private volatile b:Z

.field private final c:Z

.field private d:Ljava/util/concurrent/ExecutorService;

.field private e:Ljava/util/concurrent/CyclicBarrier;

.field private f:Ljava/util/concurrent/atomic/AtomicInteger;

.field private g:Ljava/util/concurrent/BlockingQueue;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/concurrent/BlockingQueue<",
            "Les/gv;",
            ">;"
        }
    .end annotation
.end field

.field private h:[Les/tv;

.field private i:Ljava/util/concurrent/CopyOnWriteArrayList;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/concurrent/CopyOnWriteArrayList<",
            "Les/sv;",
            ">;"
        }
    .end annotation
.end field

.field private j:Ljava/util/concurrent/CopyOnWriteArrayList;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/concurrent/CopyOnWriteArrayList<",
            "Les/sv;",
            ">;"
        }
    .end annotation
.end field


# direct methods
.method static constructor <clinit>()V
    .locals 0

    return-void
.end method

.method public constructor <init>(Z)V
    .locals 0

    .line 1
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 2
    iput-boolean p1, p0, Les/wu;->c:Z

    .line 3
    new-instance p1, Ljava/util/concurrent/CopyOnWriteArrayList;

    invoke-direct {p1}, Ljava/util/concurrent/CopyOnWriteArrayList;-><init>()V

    iput-object p1, p0, Les/wu;->i:Ljava/util/concurrent/CopyOnWriteArrayList;

    .line 4
    new-instance p1, Ljava/util/concurrent/CopyOnWriteArrayList;

    invoke-direct {p1}, Ljava/util/concurrent/CopyOnWriteArrayList;-><init>()V

    iput-object p1, p0, Les/wu;->j:Ljava/util/concurrent/CopyOnWriteArrayList;

    return-void
.end method

.method static synthetic a(Les/wu;)Ljava/util/concurrent/CyclicBarrier;
    .locals 0

    .line 1
    iget-object p0, p0, Les/wu;->e:Ljava/util/concurrent/CyclicBarrier;

    return-object p0
.end method

.method static synthetic a(Les/wu;Les/gv;)V
    .locals 0

    .line 3
    invoke-direct {p0, p1}, Les/wu;->c(Les/gv;)V

    return-void
.end method

.method static synthetic a(Les/wu;Z)Z
    .locals 0

    .line 2
    iput-boolean p1, p0, Les/wu;->a:Z

    return p1
.end method

.method static synthetic b()Ljava/lang/String;
    .locals 1

    .line 3
    sget-object v0, Les/wu;->k:Ljava/lang/String;

    return-object v0
.end method

.method private b(Les/gv;)V
    .locals 1

    .line 5
    :try_start_0
    iget-object v0, p0, Les/wu;->f:Ljava/util/concurrent/atomic/AtomicInteger;

    invoke-virtual {v0}, Ljava/util/concurrent/atomic/AtomicInteger;->incrementAndGet()I

    .line 6
    iget-object v0, p0, Les/wu;->g:Ljava/util/concurrent/BlockingQueue;

    invoke-interface {v0, p1}, Ljava/util/concurrent/BlockingQueue;->put(Ljava/lang/Object;)V
    :try_end_0
    .catch Ljava/lang/InterruptedException; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_0

    :catch_0
    move-exception p1

    .line 7
    invoke-virtual {p1}, Ljava/lang/InterruptedException;->printStackTrace()V

    :goto_0
    return-void
.end method

.method static synthetic b(Les/wu;)Z
    .locals 0

    .line 1
    iget-boolean p0, p0, Les/wu;->a:Z

    return p0
.end method

.method static synthetic b(Les/wu;Z)Z
    .locals 0

    .line 2
    iput-boolean p1, p0, Les/wu;->b:Z

    return p1
.end method

.method private c(Les/gv;)V
    .locals 4

    .line 10
    :try_start_0
    iget-object v0, p0, Les/wu;->i:Ljava/util/concurrent/CopyOnWriteArrayList;

    if-eqz v0, :cond_0

    .line 11
    iget-object v0, p0, Les/wu;->i:Ljava/util/concurrent/CopyOnWriteArrayList;

    invoke-virtual {v0}, Ljava/util/concurrent/CopyOnWriteArrayList;->iterator()Ljava/util/Iterator;

    move-result-object v0

    :goto_0
    invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z

    move-result v1

    if-eqz v1, :cond_0

    invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Les/sv;

    .line 12
    invoke-interface {v1, p1}, Les/sv;->a(Les/gv;)V

    goto :goto_0

    .line 13
    :cond_0
    iget-object v0, p0, Les/wu;->h:[Les/tv;

    if-eqz v0, :cond_1

    .line 14
    iget-object v0, p0, Les/wu;->h:[Les/tv;

    array-length v1, v0

    const/4 v2, 0x0

    :goto_1
    if-ge v2, v1, :cond_1

    aget-object v3, v0, v2

    .line 15
    invoke-interface {v3, p1}, Les/sv;->a(Les/gv;)V

    add-int/lit8 v2, v2, 0x1

    goto :goto_1

    .line 16
    :cond_1
    iget-object v0, p0, Les/wu;->j:Ljava/util/concurrent/CopyOnWriteArrayList;

    if-eqz v0, :cond_2

    .line 17
    iget-object v0, p0, Les/wu;->j:Ljava/util/concurrent/CopyOnWriteArrayList;

    invoke-virtual {v0}, Ljava/util/concurrent/CopyOnWriteArrayList;->iterator()Ljava/util/Iterator;

    move-result-object v0

    :goto_2
    invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z

    move-result v1

    if-eqz v1, :cond_2

    invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Les/sv;

    .line 18
    invoke-interface {v1, p1}, Les/sv;->a(Les/gv;)V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_2

    :catch_0
    move-exception p1

    .line 19
    invoke-virtual {p1}, Ljava/lang/Exception;->printStackTrace()V

    :cond_2
    return-void
.end method

.method private final c()Z
    .locals 4

    .line 2
    sget-object v0, Les/wu;->k:Ljava/lang/String;

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "Processor Tracer: "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    iget-object v2, p0, Les/wu;->f:Ljava/util/concurrent/atomic/AtomicInteger;

    invoke-virtual {v2}, Ljava/util/concurrent/atomic/AtomicInteger;->get()I

    move-result v2

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    const-string v2, ", Queue: "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    iget-object v2, p0, Les/wu;->g:Ljava/util/concurrent/BlockingQueue;

    invoke-interface {v2}, Ljava/util/concurrent/BlockingQueue;->size()I

    move-result v2

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-static {v0, v1}, Lcom/estrongs/android/util/n;->c(Ljava/lang/String;Ljava/lang/String;)V

    .line 3
    iget-boolean v0, p0, Les/wu;->b:Z

    const/4 v1, 0x0

    if-eqz v0, :cond_1

    iget-object v0, p0, Les/wu;->f:Ljava/util/concurrent/atomic/AtomicInteger;

    invoke-virtual {v0}, Ljava/util/concurrent/atomic/AtomicInteger;->get()I

    move-result v0

    if-nez v0, :cond_1

    iget-object v0, p0, Les/wu;->g:Ljava/util/concurrent/BlockingQueue;

    invoke-interface {v0}, Ljava/util/concurrent/BlockingQueue;->isEmpty()Z

    move-result v0

    if-eqz v0, :cond_1

    .line 4
    sget-object v0, Les/wu;->k:Ljava/lang/String;

    const-string v2, "check the processor finished!"

    invoke-static {v0, v2}, Lcom/estrongs/android/util/n;->c(Ljava/lang/String;Ljava/lang/String;)V

    .line 5
    iget-object v0, p0, Les/wu;->g:Ljava/util/concurrent/BlockingQueue;

    monitor-enter v0

    .line 6
    :try_start_0
    iget-boolean v2, p0, Les/wu;->a:Z

    const/4 v3, 0x1

    if-nez v2, :cond_0

    .line 7
    monitor-exit v0

    return v3

    .line 8
    :cond_0
    iput-boolean v1, p0, Les/wu;->a:Z

    .line 9
    monitor-exit v0

    return v3

    :catchall_0
    move-exception v1

    monitor-exit v0
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw v1

    :cond_1
    return v1
.end method

.method static synthetic c(Les/wu;)Z
    .locals 0

    .line 1
    invoke-direct {p0}, Les/wu;->c()Z

    move-result p0

    return p0
.end method

.method static synthetic d(Les/wu;)Ljava/util/concurrent/BlockingQueue;
    .locals 0

    .line 1
    iget-object p0, p0, Les/wu;->g:Ljava/util/concurrent/BlockingQueue;

    return-object p0
.end method

.method private d()V
    .locals 4

    .line 2
    sget-object v0, Les/wu;->k:Ljava/lang/String;

    const-string v1, "start processing..."

    invoke-static {v0, v1}, Lcom/estrongs/android/util/n;->a(Ljava/lang/String;Ljava/lang/String;)V

    .line 3
    iget-object v0, p0, Les/wu;->f:Ljava/util/concurrent/atomic/AtomicInteger;

    const/4 v1, 0x0

    invoke-virtual {v0, v1}, Ljava/util/concurrent/atomic/AtomicInteger;->set(I)V

    const/4 v0, 0x1

    .line 4
    iput-boolean v0, p0, Les/wu;->a:Z

    .line 5
    iput-boolean v1, p0, Les/wu;->b:Z

    .line 6
    new-instance v0, Les/av;

    const-string v2, "Disk Scanner Handler"

    invoke-direct {v0, v2}, Les/av;-><init>(Ljava/lang/String;)V

    .line 7
    invoke-static {}, Ljava/lang/Runtime;->getRuntime()Ljava/lang/Runtime;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/Runtime;->availableProcessors()I

    move-result v2

    add-int/lit8 v2, v2, 0x2

    .line 8
    invoke-static {v2, v0}, Ljava/util/concurrent/Executors;->newFixedThreadPool(ILjava/util/concurrent/ThreadFactory;)Ljava/util/concurrent/ExecutorService;

    move-result-object v0

    iput-object v0, p0, Les/wu;->d:Ljava/util/concurrent/ExecutorService;

    .line 9
    new-instance v0, Ljava/util/concurrent/CyclicBarrier;

    invoke-direct {v0, v2}, Ljava/util/concurrent/CyclicBarrier;-><init>(I)V

    iput-object v0, p0, Les/wu;->e:Ljava/util/concurrent/CyclicBarrier;

    :goto_0
    if-ge v1, v2, :cond_0

    .line 10
    iget-object v0, p0, Les/wu;->d:Ljava/util/concurrent/ExecutorService;

    new-instance v3, Les/wu$a;

    invoke-direct {v3, p0}, Les/wu$a;-><init>(Les/wu;)V

    invoke-interface {v0, v3}, Ljava/util/concurrent/ExecutorService;->execute(Ljava/lang/Runnable;)V

    add-int/lit8 v1, v1, 0x1

    goto :goto_0

    :cond_0
    return-void
.end method

.method private d(Les/gv;)V
    .locals 0

    .line 11
    invoke-direct {p0, p1}, Les/wu;->c(Les/gv;)V

    return-void
.end method

.method static synthetic e(Les/wu;)Ljava/util/concurrent/atomic/AtomicInteger;
    .locals 0

    .line 1
    iget-object p0, p0, Les/wu;->f:Ljava/util/concurrent/atomic/AtomicInteger;

    return-object p0
.end method


# virtual methods
.method public a(Les/bv;)V
    .locals 4

    .line 26
    :try_start_0
    iget-object v0, p0, Les/wu;->i:Ljava/util/concurrent/CopyOnWriteArrayList;

    if-eqz v0, :cond_0

    .line 27
    iget-object v0, p0, Les/wu;->i:Ljava/util/concurrent/CopyOnWriteArrayList;

    invoke-virtual {v0}, Ljava/util/concurrent/CopyOnWriteArrayList;->iterator()Ljava/util/Iterator;

    move-result-object v0

    :goto_0
    invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z

    move-result v1

    if-eqz v1, :cond_0

    invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Les/sv;

    .line 28
    invoke-interface {v1, p1}, Les/sv;->a(Les/bv;)V

    goto :goto_0

    .line 29
    :cond_0
    iget-object v0, p0, Les/wu;->h:[Les/tv;

    if-eqz v0, :cond_1

    .line 30
    iget-object v0, p0, Les/wu;->h:[Les/tv;

    array-length v1, v0

    const/4 v2, 0x0

    :goto_1
    if-ge v2, v1, :cond_1

    aget-object v3, v0, v2

    .line 31
    invoke-interface {v3, p1}, Les/sv;->a(Les/bv;)V

    add-int/lit8 v2, v2, 0x1

    goto :goto_1

    .line 32
    :cond_1
    iget-object v0, p0, Les/wu;->j:Ljava/util/concurrent/CopyOnWriteArrayList;

    if-eqz v0, :cond_2

    .line 33
    iget-object v0, p0, Les/wu;->j:Ljava/util/concurrent/CopyOnWriteArrayList;

    invoke-virtual {v0}, Ljava/util/concurrent/CopyOnWriteArrayList;->iterator()Ljava/util/Iterator;

    move-result-object v0

    :goto_2
    invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z

    move-result v1

    if-eqz v1, :cond_2

    invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Les/sv;

    .line 34
    invoke-interface {v1, p1}, Les/sv;->a(Les/bv;)V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_2

    :catch_0
    move-exception p1

    .line 35
    invoke-virtual {p1}, Ljava/lang/Exception;->printStackTrace()V

    :cond_2
    return-void
.end method

.method public a(Les/gv;)V
    .locals 1

    .line 23
    iget-boolean v0, p0, Les/wu;->c:Z

    if-eqz v0, :cond_0

    .line 24
    invoke-direct {p0, p1}, Les/wu;->b(Les/gv;)V

    goto :goto_0

    .line 25
    :cond_0
    invoke-direct {p0, p1}, Les/wu;->d(Les/gv;)V

    :goto_0
    return-void
.end method

.method public a(Les/hv;)V
    .locals 4

    .line 36
    :try_start_0
    iget-object v0, p0, Les/wu;->i:Ljava/util/concurrent/CopyOnWriteArrayList;

    if-eqz v0, :cond_0

    .line 37
    iget-object v0, p0, Les/wu;->i:Ljava/util/concurrent/CopyOnWriteArrayList;

    invoke-virtual {v0}, Ljava/util/concurrent/CopyOnWriteArrayList;->iterator()Ljava/util/Iterator;

    move-result-object v0

    :goto_0
    invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z

    move-result v1

    if-eqz v1, :cond_0

    invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Les/sv;

    .line 38
    invoke-interface {v1, p1}, Les/sv;->a(Les/hv;)V

    goto :goto_0

    .line 39
    :cond_0
    iget-object v0, p0, Les/wu;->h:[Les/tv;

    if-eqz v0, :cond_1

    .line 40
    iget-object v0, p0, Les/wu;->h:[Les/tv;

    array-length v1, v0

    const/4 v2, 0x0

    :goto_1
    if-ge v2, v1, :cond_1

    aget-object v3, v0, v2

    .line 41
    invoke-interface {v3, p1}, Les/sv;->a(Les/hv;)V

    add-int/lit8 v2, v2, 0x1

    goto :goto_1

    .line 42
    :cond_1
    iget-object v0, p0, Les/wu;->j:Ljava/util/concurrent/CopyOnWriteArrayList;

    if-eqz v0, :cond_2

    .line 43
    iget-object v0, p0, Les/wu;->j:Ljava/util/concurrent/CopyOnWriteArrayList;

    invoke-virtual {v0}, Ljava/util/concurrent/CopyOnWriteArrayList;->iterator()Ljava/util/Iterator;

    move-result-object v0

    :goto_2
    invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z

    move-result v1

    if-eqz v1, :cond_2

    invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Les/sv;

    .line 44
    invoke-interface {v1, p1}, Les/sv;->a(Les/hv;)V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_2

    :catch_0
    move-exception p1

    .line 45
    invoke-virtual {p1}, Ljava/lang/Exception;->printStackTrace()V

    :cond_2
    return-void
.end method

.method public a(Les/sv;)V
    .locals 1

    if-eqz p1, :cond_0

    .line 4
    iget-object v0, p0, Les/wu;->j:Ljava/util/concurrent/CopyOnWriteArrayList;

    invoke-virtual {v0, p1}, Ljava/util/concurrent/CopyOnWriteArrayList;->add(Ljava/lang/Object;)Z

    :cond_0
    return-void
.end method

.method public a(Ljava/util/concurrent/ExecutorService;)V
    .locals 9

    .line 5
    invoke-static {}, Ljava/lang/System;->currentTimeMillis()J

    move-result-wide v0

    .line 6
    invoke-virtual {p0}, Les/wu;->a()[Les/tv;

    move-result-object v2

    iput-object v2, p0, Les/wu;->h:[Les/tv;

    const/4 v3, 0x0

    if-eqz p1, :cond_1

    if-eqz v2, :cond_1

    .line 7
    array-length v2, v2

    .line 8
    new-instance v4, Ljava/util/concurrent/CountDownLatch;

    invoke-direct {v4, v2}, Ljava/util/concurrent/CountDownLatch;-><init>(I)V

    .line 9
    iget-object v2, p0, Les/wu;->h:[Les/tv;

    array-length v5, v2

    const/4 v6, 0x0

    :goto_0
    if-ge v6, v5, :cond_0

    aget-object v7, v2, v6

    .line 10
    new-instance v8, Les/wu$b;

    invoke-direct {v8, p0, v7, v4}, Les/wu$b;-><init>(Les/wu;Les/tv;Ljava/util/concurrent/CountDownLatch;)V

    .line 11
    invoke-interface {p1, v8}, Ljava/util/concurrent/ExecutorService;->execute(Ljava/lang/Runnable;)V

    add-int/lit8 v6, v6, 0x1

    goto :goto_0

    .line 12
    :cond_0
    :try_start_0
    invoke-virtual {v4}, Ljava/util/concurrent/CountDownLatch;->await()V
    :try_end_0
    .catch Ljava/lang/InterruptedException; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_2

    :catch_0
    move-exception p1

    .line 13
    invoke-virtual {p1}, Ljava/lang/InterruptedException;->printStackTrace()V

    goto :goto_2

    .line 14
    :cond_1
    iget-object p1, p0, Les/wu;->h:[Les/tv;

    if-eqz p1, :cond_2

    .line 15
    array-length v2, p1

    const/4 v4, 0x0

    :goto_1
    if-ge v4, v2, :cond_2

    aget-object v5, p1, v4

    .line 16
    invoke-interface {v5, v3}, Les/tv;->a(Z)V

    add-int/lit8 v4, v4, 0x1

    goto :goto_1

    .line 17
    :cond_2
    :goto_2
    invoke-static {}, Ljava/lang/System;->currentTimeMillis()J

    move-result-wide v4

    .line 18
    sget-object p1, Les/wu;->k:Ljava/lang/String;

    new-instance v2, Ljava/lang/StringBuilder;

    invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V

    const-string v6, "Expired: "

    invoke-virtual {v2, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    sub-long/2addr v4, v0

    invoke-virtual {v2, v4, v5}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;

    const-string v0, " ms to load handler cache"

    invoke-virtual {v2, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-static {p1, v0}, Lcom/estrongs/android/util/n;->b(Ljava/lang/String;Ljava/lang/String;)V

    .line 19
    iget-boolean p1, p0, Les/wu;->c:Z

    if-eqz p1, :cond_3

    .line 20
    new-instance p1, Ljava/util/concurrent/atomic/AtomicInteger;

    invoke-direct {p1, v3}, Ljava/util/concurrent/atomic/AtomicInteger;-><init>(I)V

    iput-object p1, p0, Les/wu;->f:Ljava/util/concurrent/atomic/AtomicInteger;

    .line 21
    new-instance p1, Ljava/util/concurrent/LinkedBlockingQueue;

    invoke-direct {p1}, Ljava/util/concurrent/LinkedBlockingQueue;-><init>()V

    iput-object p1, p0, Les/wu;->g:Ljava/util/concurrent/BlockingQueue;

    .line 22
    invoke-direct {p0}, Les/wu;->d()V

    :cond_3
    return-void
.end method

.method protected abstract a()[Les/tv;
.end method

.method public b(Les/sv;)V
    .locals 1

    if-eqz p1, :cond_0

    .line 4
    iget-object v0, p0, Les/wu;->i:Ljava/util/concurrent/CopyOnWriteArrayList;

    invoke-virtual {v0, p1}, Ljava/util/concurrent/CopyOnWriteArrayList;->add(Ljava/lang/Object;)Z

    :cond_0
    return-void
.end method
